<div id="posts" class="backend-item quizs">
	<?php include_once '/../supMenu.html';?>
	<br>
	<h2 class="backend-h2"><span class="img"></span><span> Kiểm tra</span>
        <a href="<?php echo $this->baseUrl('/admin/quiz/add/');?>">Tạo bài test mới</a>
    </h2>
    <p class="saporator"><br /></p>
    
    <form action="" method="get">
        <p class="search_box">
            <input class="sbt hover focus" type="text" name="search_box_text" title="Nhập vào tên cần tìm"/>
            <input class="sbc input-hover" type="submit" name="search_box_sumit"  value="Tìm"/>
        </p><!-- End .search_box-->
        <p class="saporator sf"><br /></p>
         
        <div class="table_nav">
        	<div class="table_nav_left">
            	<select id="tbn_cat" name="tbn_cate">
                	<option value="" selected="selected">Hiển thị tất cả</option>
                    <?php 
                    	foreach ($this->monHoc as $mon) {
                    		if(isset($_REQUEST['cbbMon']) && $_REQUEST['cbbMon']==$mon['id']){
                    			echo '<option value ="'.$mon['id'].'" selected>'.$mon['tenMonHoc'].'</option>';	
                    		}else{
                    			echo '<option value ="'.$mon['id'].'">'.$mon['tenMonHoc'].'</option>';
                    		}
                    		
                    	}
                    ?>                 
                </select>
                    
                <input type="submit" value="Lọc" name="tbn_filter" class="tbn_button input-hover"/> <!-- tbn: là viết tắt của từ table_nav trong div class="table_nav" -->
                <input type="submit" value="Xóa" name="del" class="tbn_button input-hover"/>
            </div><!-- end .table_nav_left -->
            <div class="table_nav_pages">  
            <?php 
                	//phan trang
				echo $this->paginationControl($this->paginatorExame,'sliding','tinyPaginator.phtml');
			?>                           
            </div>
        </div><!-- End .table_nav-->
        <table id="p_post">
            <thead>
                <tr>
                    <th class="col-1-quiz"><input class="check-all" type="checkbox" /></th>
                    <th class="col-2-quiz">Lớp</th>
                    <th class="col-3-quiz">Tên</th>
                    <th class="col-4-quiz">Thời gian</th>
                    <th class="col-5-quiz">Số câu hỏi</th>
                    <th class="col-6-quiz">Thời gian bắt đầu</th>
                    <th class="col-7-quiz">Thời gian kết thúc</th>
                    <th class="col-8-quiz">Trạng thái</th>                    
                </tr>
            </thead>
            <tbody>
            <?php 
            	foreach ($this->paginatorExame as $exame){
            		
            		$expired = explode("/", $exame['dateEnd']);
            		$now = getdate();
            			
            		if(mktime(0,0,0,$expired[1],$expired[0],$expired[2]) < mktime(0,0,0,$now['mon'],$now['mday'],$now['year'])){
            			switch ($exame['status']) {
            				case 0: $status = "Đã làm"; 
            					break;
            				default: $status = "Hết thời gian làm";
 		           				break;
            			}
            		}else{
            			switch ($exame['status']) {
            				case 0: $status = "Đã làm"; 
            					break;
            				case 1: $status = "Trong thời gian làm";
            					break;
            				default: $status = "Chưa làm";
 		           				break;
            			}
            		}
            		
            		
            ?>    
                <tr>
                    <th class="col-1-quiz">
                        <input class="sub-check" name="lop-check[]" type="checkbox" value="<?php echo $exame['idKiemTra']; ?>"/>
                    </th>
                    <th class="col-2-quiz"><?php echo $exame['idLop']; ?></th>
                    <th class="col-3-quiz post_title quiz-ten">
                        <strong><a href="<?php echo $this->baseUrl('/admin/quiz/add/?editlist&id='.$exame['idKiemTra'].'&idlop='.$exame['idLop']);?>" class="title_ct">
                        	<?php echo $exame['ten']; ?></a>
                        </strong> 
	                    <div class="row_action">
	                        <span class="row_edit">
	                        	<a href="<?php echo $this->baseUrl('/admin/quiz/add/?editlist&id='.$exame['idKiemTra'].'&idlop='.$exame['idLop']);?>">Sửa</a>|
	                        </span>
	                        <span class="row_del">
	                        	<a href="<?php echo $this->baseUrl('/admin/quiz/delete/?deletelist&id='.$exame['idKiemTra']).'&idlop='.$exame['idLop'];?>">Xóa</a>|
	                        </span>  
	                        <span class="row_del">
	                        	<a href="<?php echo $this->baseUrl('/admin/quiz/doexame/?exe&id='.$exame['idKiemTra']);?>">Làm bài</a>
	                        </span>                       
	                    </div>
                    </th>
                    <th class="col-4-quiz"><?php echo $exame['thoiGian']; ?></th>
                    <th class="col-5-quiz"><?php echo $exame['soCauHoi']; ?></th>
                    <th class="col-6-quiz"><?php echo $exame['dateStart'].'-'.$exame['hourStart']; ?></th>
                    <th class="col-7-quiz"><?php echo $exame['dateEnd'].'-'.$exame['hourEnd']; ?></th>
                    <th class="col-8-quiz"><?php echo $status; ?></th>    
                </tr>                                          
            <?php 
            	}
            ?>             
            </tbody>
            <tfoot>
                <tr>
                    <th class="col-1-quiz"><input class="check-all" type="checkbox" /></th>
                    <th class="col-2-quiz">Lớp</th>
                    <th class="col-3-quiz">Tên</th>
                    <th class="col-4-quiz">Thời gian</th>
                    <th class="col-5-quiz">Số câu hỏi</th>
                    <th class="col-6-quiz">Thời gian bắt đầu</th>
                    <th class="col-7-quiz">Thời gian kết thúc</th>
                    <th class="col-8-quiz">Trạng thái</th>                 
                </tr>
            </tfoot>
        </table>
                
    </form>
    
</div><!-- end #posts -->
